package com.yanqu.road.server.manger.config.grandchild.talent.effect;

import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentTriggerSkillParam;
import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentTriggerSkillResult;
import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentTriggerSkillResultBuilder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SkillEffect100 implements ISkillEffect {

    @Override
    public TalentTriggerSkillResult getResult(TalentTriggerSkillParam param) {
        List<Integer> paramList = param.getSkillInfo().getParamList();
        Integer index = paramList.get(2);
        Integer value = paramList.get(0);
        Map<Integer, Integer> flairChangeMap = new HashMap<>();
        List<Integer> flairList = param.getGrandChild().getFlairList();
        if (index > 0) {

            // 单个职业生效
            flairChangeMap.put(index - 1, value);
        } else if (index == 0) {

            // 全部职业生效
            for (int i = 0; i < flairList.size(); i++) {
                flairChangeMap.put(index - 1, value);
            }

        }

        return TalentTriggerSkillResultBuilder.aTalentTriggerSkillResult().setAddFlairList(flairChangeMap).setActive(true).build();
    }

}
